//index.js
//获取应用实例
const app = getApp()

Page({
  data: {
   up:"",
   down:""
  },
  
  onLoad: function () {
   
   
  },
  getUpText(e){
      const up = e.detail.detail.value;
      this.setData({
        up: up
      })
  },
  formSubmit(e){
    console.log(e);
    const value = this.data.up;
    const that = this;
    this.setData({
      down: ""
    })
    wx.request({
      url: 'http://127.0.0.1:8888/api/couplet',
      data:{
        up:value
      },
      success: function(data){
        console.log(data.data, typeof data.data);
        const couplet = data.data;
        const down = couplet.down;
        console.log(down);
        that.setData({
          down: down
        })
      }
    })
  }
})
